/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('wstest', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model TestPopHsfFailedRequest {
  name?: string(name='Name'),
}

model TestPopHsfFailedResponseBody = {
  name?: string(name='Name'),
  requestId?: string(name='RequestId'),
}

model TestPopHsfFailedResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: TestPopHsfFailedResponseBody(name='body'),
}

async function testPopHsfFailedWithOptions(request: TestPopHsfFailedRequest, runtime: Util.RuntimeOptions): TestPopHsfFailedResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'TestPopHsfFailed',
    version = '2022-07-07',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function testPopHsfFailed(request: TestPopHsfFailedRequest): TestPopHsfFailedResponse {
  var runtime = new Util.RuntimeOptions{};
  return testPopHsfFailedWithOptions(request, runtime);
}

